package cn.bugstack.springframework.test.bean;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * 自定义增强逻辑
 * @author LiuDehuai
 * @fileName:MyInterceptor
 * @Date:2022/4/8 12:54
 */
public class MyMethodInterceptor implements MethodInterceptor {
    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.out.println("custom enhance before");
        try{
            //调用原方法
            return methodInvocation.proceed();
        }finally {
            System.out.println("custom enhance finally");
        }

    }
}
